package com.wyx.bbs.service;

import com.wyx.bbs.domain.Article;
import com.wyx.bbs.domain.ArticleToUser;
import com.wyx.bbs.domain.PostToUser;
import com.wyx.bbs.domain.ThumbsUp;
import com.wyx.bbs.mapper.ArticleMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: Wu YunXia
 * @Description: 文章
 * @Date: Created in 11:21 2021/3/31
 * @Modefied By:
 */
@Service
public class ArticleService {
    @Resource
    ArticleMapper articleMapper;


/**
 * 添加
 * @param post
 * @return
 */
public int addPost (Article post){
        return articleMapper.addPost(post);
    }


/**
 * 查询全部
 */
public List<ArticleToUser> getArticleAll (Integer uid){
    return articleMapper.getArticleAll(uid);
}


/**
 * 查询全部 一登陆
 * @return
 */
public List<PostToUser> getAllPost (Integer uid){
        return articleMapper.getAll(uid);
    }



/**
 * 按PostId查询
 * @param postId
 * @return
 */
public List<ArticleToUser> getByPostId (Integer postId, Integer uid){
        return articleMapper.getByPostId(postId, uid);
    }




/**
 * 按uid查询
 * @param uid
 * @return
 */
public List<ArticleToUser> getByUid (Integer uid, Integer selfId){
        return articleMapper.getByUid(uid, selfId);
    }


/**
 * 按id删除
 * @param id
 * @return
 */
public int delArticle (Integer id){
        return articleMapper.delArticle(id);
    }
}
